<template>
  <div class="home">
    <ly-tab v-model="selectedId" :items="items" :options="options" @change="handleto" class="fix"></ly-tab>
    <router-view></router-view>
  </div>
</template>
<script>
export default {
  data() {
    return {
      selectedId: 0,
      items: [
        { label: "热门" },
        { label: "服饰" },
        { label: "鞋包" },
        { label: "母婴" },
        { label: "百货" },
        { label: "食品" },
        { label: "内衣" },
        { label: "男装" },
        { label: "电器" }
      ],
      subRouterUrl: [
        "/home/hot",
        "/home/dress",
        "/home/box",
        "/home/mbaby",
        "/home/general",
        "/home/food",
        "/home/shirt",
        "/home/man",
        "/home/ele"
      ],
      options: {
        activeColor: "#e9232c"
        // 可在这里指定labelKey为你数据里文字对应的字段名
      }
    };
  },
  methods: {
    handleto(item, index) {
      // console.log(item,index)
      this.$router.replace(this.subRouterUrl[index]);
    }
  }
};
</script>
<style lang='scss' scoped>
.home {
  margin-top: 50px;
  margin-bottom: 65px;
  height: 100vh;
  overflow:auto;
  .fix {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 9998;
  }
}
</style>